package com.tjhzzx.hnceCore2024.model.menu;


import com.tjhzzx.hnceCore2024.enums.BTreeMenuItemType;
import com.tjhzzx.hnceCore2024.model.common.BBaseComponent;
import com.tjhzzx.hnceCore2024.model.ext.BDashboardRoot;
import com.tjhzzx.hnceCore2024.model.table.BDataTable;

import javax.baja.agent.BPxView;
import javax.baja.sys.Flags;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.BFolder;

public class BTreeMenuItem extends BBaseComponent {

    public static final Property redirectToBase = newProperty(Flags.HIDDEN, false, null);

    public boolean getRedirectToBase() {
        return getBoolean(redirectToBase);
    }

    public void setRedirectToBase(boolean v) {
        setBoolean(redirectToBase, v, null);
    }

    public static final Property baseUrl = newProperty(Flags.HIDDEN, "http://", null);

    public String getBaseUrl() {
        return getString(baseUrl);
    }

    public void setBaseUrl(String v) {
        setString(baseUrl, v, null);
    }

    public static final Property treeMenuItemType = newProperty(0, BTreeMenuItemType.DEFAULT, null);

    public BTreeMenuItemType getTreeMenuItemType() {
        return (BTreeMenuItemType) get(treeMenuItemType);
    }

    public void setTreeMenuItemType(BTreeMenuItemType v) {
        set(treeMenuItemType, v, null);
    }

    public static final Property pagePath = newProperty(0, "/TreeMenuItem", null);

    public String getPagePath() {
        return getString(pagePath);
    }

    public void setPagePath(String v) {
        setString(pagePath, v, null);
    }

    public static final Property pxView = newProperty(0, new BPxView(), null);

    public BPxView getPxView() {
        return (BPxView) get(pxView);
    }

    public void setPxView(BPxView v) {
        set(pxView, v, null);
    }

    public static final Property searchParamRoot = newProperty(0, new BFolder(), null);

    public BFolder getSearchParamRoot() {
        return (BFolder) get(searchParamRoot);
    }

    public void setSearchParamRoot(BFolder v) {
        set(searchParamRoot, v, null);
    }

    public static final Property url = newProperty(0, "https://", null);

    public String getUrl() {
        return getString(url);
    }

    public void setUrl(String v) {
        setString(url, v, null);
    }

    public static final Property dashboardRoot = newProperty(0, new BDashboardRoot(), null);

    public BDashboardRoot getDashboardRoot() {
        return (BDashboardRoot) get(dashboardRoot);
    }

    public void setDashboardRoot(BDashboardRoot v) {
        set(dashboardRoot, v, null);
    }

    public static final Property dataTableRoot = newProperty(0, new BDataTable(), null);

    public BDataTable getDataTableRoot() {
        return (BDataTable) get(dataTableRoot);
    }

    public void setDataTableRoot(BDataTable v) {
        set(dataTableRoot, v, null);
    }

    public static final Property treeMenuItemTypeExpose = newProperty(Flags.HIDDEN, BTreeMenuItemType.expose(), null);

    public String getTreeMenuItemTypeExpose() {
        return getString(treeMenuItemTypeExpose);
    }

    public void setTreeMenuItemTypeExpose(String v) {
        setString(treeMenuItemTypeExpose, v, null);
    }

//    @Override
//    public void changed(Property property, Context context) {
//        super.changed(property, context);
//        if (property.getType() == BTreeMenuItemType.TYPE) {
//            String tag = propertyValueToString(property, context);
//            if (tag.equals(BTreeMenuItemType.pxView.toString(context))) {
//                this.setFlags(this.getSlot("searchParamRoot"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("carouselPage"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("velocityName"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("url"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("pxView"), 0, Context.commit);
//            } else if (tag.equals(BTreeMenuItemType.searchParams.toString(context))) {
//                this.setFlags(this.getSlot("carouselPage"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("velocityName"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("url"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("pxView"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("searchParamRoot"), 0, Context.commit);
//            } else if (tag.equals(BTreeMenuItemType.carouselPage.toString(context))) {
//                this.setFlags(this.getSlot("velocityName"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("url"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("pxView"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("searchParamRoot"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("carouselPage"), 0, Context.commit);
//            } else if (tag.equals(BTreeMenuItemType.url.toString(context))) {
//                this.setFlags(this.getSlot("velocityName"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("pxView"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("searchParamRoot"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("carouselPage"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("url"), 0, Context.commit);
//            } else {
//                this.setFlags(this.getSlot("pxView"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("searchParamRoot"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("carouselPage"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("url"), Flags.HIDDEN, Context.commit);
//                this.setFlags(this.getSlot("velocityName"), 0, Context.commit);
//            }
//        }
//    }

    public BTreeMenuItem() {
        setTitle("通用菜单");
        setNIcon("file");
    }

    @Override
    public Type getType() {
        return TYPE;
    }

    public static final Type TYPE = Sys.loadType(BTreeMenuItem.class);
}
